package src.thread;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Scanner;

public class SleepDemo {
        public static void main(String[] args) {
                System.out.println("感君一回顾");
                try {
                        Thread.sleep(5000);//主线程执行会阻塞5秒
                } catch (InterruptedException e) {
                        e.printStackTrace();
                }
                System.out.println("思君朝与暮");
/*
                BufferedReader br=new BufferedReader(
                    new InputStreamReader(
                        System.in
                    )
                );
                try {
                        String li= br.readLine();
                        int nu=Integer.parseInt(li);
                } catch (IOException e) {
                        e.printStackTrace();
                }


 */

                System.out.println("请输入一个数字:");
                Scanner scanner = new Scanner(System.in);
                String line =scanner.nextLine();
                int num=Integer.parseInt(line);
                        for (; num>0;num--) {
                                try {
                                        Thread.sleep(100);
                                } catch (InterruptedException e) {
                                        e.printStackTrace();
                                }
                                System.out.println(num);
                        }
                System.out.println("时间到！");
                System.out.println("程序结束了");
                }

        }

